<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
	contentType="text/html; charset=UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>额定人数设置</title>
<link rel="stylesheet" type="text/css"
	href="<%=path%>/jquery-easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"
	href="<%=path%>/jquery-easyui/themes/icon.css">
<style type="text/css">
</style>
<script type="text/javascript"
	src="<%=path%>/jquery-easyui/jquery-1.8.0.js"></script>
<script type="text/javascript"
	src="<%=path%>/jquery-easyui/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="<%=path%>/js/jquery.json-2.4.js"></script>
<script type="text/javascript" src="<%=path%>/js/post.js"></script>
<script type="text/javascript" src="<%=path%>/js/util.js"></script>
<script type="text/javascript">
	var path = '${pageContext.request.contextPath}';

	function edit() {
		var grid = $('#grid');
		var row = grid.datagrid('getSelected');
		if (!row) {
			$.messager.alert('提示', '请选择数据!');
			return;
		}

		var form = $('#form');
		form.form('clear');
		form.form('load', row);
		$('#dlgWin').dialog('open');
	}

	function save() {
		var name = 'company';
		var url = path + '/' + name + '/save/';
		postJson($('#dlgWin'), $('#form'), $('#grid'), url, name);
	}
</script>
</head>
<body class="easyui-layout">

	<div id="dlgWin" class="easyui-dialog" title="添加时间段"
		style="width:260px;height:160px;padding:10px"
		data-options="
				closed: true,
				modal: true,
				iconCls: 'icon-save',				
				buttons: [{
					text:'確定',
					iconCls:'icon-ok',
					handler:function(){
						save();
					}
				},{
					text:'取消',
					iconCls:'icon-cancel',
					handler:function(){
						$('#dlgWin').dialog('close');
					}
				}]
			">
		<form id="form" method="post">
			<input id="id" name="id" type="hidden" /> <input id="departmentId"
				name="departmentId" type="hidden" />
			<table>
				<tr>
					<td>单位:</td>
					<td><input id="departmentName" class="easyui-validatebox"
						type="text" readonly="readonly" name="departmentName"
						data-options="required:true" style="width:130px;height:14px" />
					</td>
				</tr>
				<tr>
					<td>额定人数:</td>
					<td><input id="quantity" class="easyui-numberspinner" name="quantity"
						data-options="required:true,min:0,max:2000" /></td>
				</tr>
			</table>
		</form>
	</div>

	<!-- 工具栏 -->
	<div id="tb" style="height:auto">
		<a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true"
			onclick="edit()">编辑</a>
	</div>


	<div data-options="region:'center'">
		<table id="grid" class="easyui-datagrid"
			data-options="
			sortOrder:'asc',
			sortName:'departmentName',
			remoteSort:false,
			idField:'id',
			fit:true,
			singleSelect:true,
			collapsible:true,
			url:'<%=path%>/company/loadAll/',
			toolbar:'#tb',
			striped: true,
			fitColumns:false,
			rownumbers:true
			">
			<thead>
				<tr>
					<th
						data-options="field:'departmentName',width:100,sortable:true,align:'left'">单位</th>
					<th
						data-options="field:'quantity',width:80,sortable:true,align:'right'">额定人数</th>
				</tr>
			</thead>
		</table>

	</div>
</body>
</html>